<!--
 * @Author: hucc
 * @Date: 2021-10-08 15:31:33
 * @LastEditors: hucc
 * @LastEditTime: 2021-10-08 19:56:20
 * @Description: 
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>vue生命周期</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.13/vue.js"></script>
</head>

<body>
    <div id="app">
        <!-- 用双大括号将data数据模型中的字段渲染到页面上 -->
        {{msg}}
    </div>
    <script>
        let vm = new Vue({
            //当前vue实例的配置项
            el: '#app',
            data: {
                msg: 'hello vue'
            },
            methods: {
                findAllCategories() {
                    console.log('查询所有栏目信息')
                },
            },
            beforeCreate() {
                console.log("before create");
            },
            created() {
                console.log("created");
                this.findAllCategories();
                setTimeout(() => {
                    vm.msg = "hello vue update"
                }, 2000)
            },
            beforeMount() {
                console.log('beforeMount');
            },
            mounted() {
                console.log("mounted");
            },
            beforeUpdate() {
                console.log("beforeUpdate")
            },
            updated() {
                console.log("updated")
            },
            beforeDestroy() {
                console.log("beforeDestroy")
            },
            destroyed() {
                console.log("destroyed")
            }
        })
    </script>
</body>

</html>